using System.Web;
using Ninject.Modules;
using WroxGallery.Actions;
using WroxGallery.Controllers;
using WroxGallery.Models.Implementations;
using WroxGallery.Models.Interfaces;

namespace WroxGallery.Modules
{
    public class RepositoriesModule : NinjectModule
    {
        public override void Load()
        {
            string configurationFilePath = HttpContext.Current.Server
                .MapPath(@"App_Data\ConfigurationFile.xml");

            Bind<IConfigurationRepository>()
                .To<XmlConfigurationRepository>().InSingletonScope()
                .WithConstructorArgument("configfileName", configurationFilePath);
            
            Bind<IGalleryRepository>()
                .To<FlickrGalleryRepository>();

            Bind<IFormsAuthentication>()
                .To<FormsAuthenticationService>();

            Bind<IFlickrAPI>()
                .To<FlickrNETWrapper>();
        }
    }
}